<div id="venue_<?php echo $venueIndex; ?>_batch_<?php echo $batchIndex; ?>_groupdiscount">
    <?php
    $groupDiscount = GroupDiscount::model()->findAllByAttributes(array('class_batch_id' => $batchId));
    $groupIndex = '';
    if (!empty($groupDiscount)) {
        for ($groupIndex = 0; $groupIndex < count($groupDiscount); $groupIndex ++) {
            $discount = '';
            $inPercentage = '';
            $groupSize = '';
            $discount = $groupDiscount[$groupIndex]->discount_amount;
            $inPercentage = $groupDiscount[$groupIndex]->discount_in_percentage;
            $groupSize = $groupDiscount[$groupIndex]->group_size;
            ?>
            <div id="venue_<?php echo $venueIndex ?>_batch_<?php echo $batchIndex ?>_groupCount_<?php echo $groupIndex ?>">

                <div class="sm-col-2 addmarginB20">
                    <div class="common">
                        <div class="colEarly col1">
                            <input onchange="enableDisableGroupDiscountTextField(this.id);" name="GroupDiscount[ClassVenue][<?php echo $venueIndex ?>][ClassBatch][<?php echo $batchIndex ?>][discount_amount][]" id="class_venue_<?php echo $venueIndex ?>_classbatch_<?php echo $batchIndex ?>_group_discount_amount_<?php echo $groupIndex ?>" onblur="checkValueEmpty(this.id);" type="text" placeholder="Discount Amount" onkeypress="return isNumberKey(event)" class="<?php echo ($inPercentage != '') ? '' : 'requiredfield'; ?> field small" value="<?php echo $discount; ?>">
                            <div class="errorMessage" id="error_class_venue_<?php echo $venueIndex ?>_classbatch_<?php echo $batchIndex ?>_group_discount_amount_<?php echo $groupIndex ?>" style="display:none">Discount is required.</div>
                        </div>

                        <div class="colEarly col2">
                            <input onchange="enableDisableGroupDiscountTextField(this.id);" name="GroupDiscount[ClassVenue][<?php echo $venueIndex ?>][ClassBatch][<?php echo $batchIndex ?>][discount_in_percentage][]" id="class_venue_<?php echo $venueIndex ?>_classbatch_<?php echo $batchIndex ?>_group_in_percentage_<?php echo $groupIndex ?>" onblur="checkValueEmpty(this.id);" type="text" placeholder="Discount in percentage" onkeypress="return isNumberKey(event)" class="<?php echo ($discount != '') ? '' : 'requiredfield'; ?> field small" value="<?php echo $inPercentage; ?>">
                            <div class="errorMessage" id="error_class_venue_<?php echo $venueIndex ?>_classbatch_<?php echo $batchIndex ?>_group_in_percentage_<?php echo $groupIndex ?>" style="display:none">Amount is required.</div>
                        </div>

                        <div class="colEarly col2">
                            <input name="GroupDiscount[ClassVenue][<?php echo $venueIndex ?>][ClassBatch][<?php echo $batchIndex ?>][group_size][]" id="class_venue_<?php echo $venueIndex ?>_classbatch_<?php echo $batchIndex ?>_group_size_<?php echo $groupIndex ?>" type="text" placeholder="Group Size" onblur="checkValueEmpty(this.id)" onkeypress="return isNumberKey(event)" class="requiredfield field small"  value="<?php echo $groupSize; ?>">
                            <div class="errorMessage" id="error_class_venue_<?php echo $venueIndex ?>_classbatch_<?php echo $batchIndex ?>_group_size_<?php echo $groupIndex ?>" style="display:none">Group Size is required.</div>                
                        </div>

                        <div class="colEarlylast col2">
                            <a href="javascript:void(0)" id="venue_<?php echo $venueIndex ?>_batch_<?php echo $batchIndex ?>_groupRemove_<?php echo $groupIndex ?>" onclick="removeGroupDiscount(this.id);">-Remove</a></div>
                        <div class="clear"></div>

                    </div>

                </div>  </div>
            <?php
        }
    }
    ?>
</div>

<div class="common">
    <p class="alignL remmarginB"><a href="javascript:void(0)" id="venue_<?php echo $venueIndex; ?>_batch_<?php echo $batchIndex; ?>_groupdiscount_<?php echo ($groupIndex == '') ? '0' : $groupIndex - 1; ?>" onclick="addGroupDiscount(this.id);">+ Add Group Discounts</a></p>
</div> 